//
//  SubmitOwnerInfoModel.swift
//  ezyform
//
//  Created by Moennig Q on 13/9/2022.
//  Copyright © 2022 Client.Solution Pty Ltd. All rights reserved.
//

import Foundation
import HandyJSON
import RxSwift
class EditOwnerInfomationViewModel: NSObject, HandyJSON {
    var pvd_id: Int64 = 0
    //创建Job ，默认residential，和individual
    var property_type: PropertyType = PropertyType.residential {
        didSet{
            self.property_type_value = self.property_type.rawValue
        }
    }
    var owner_type: OwnerType = OwnerType.individual{
        didSet{
            self.owner_type_value = self.owner_type.rawValue
        }
    }
    @objc dynamic var property_type_value: String = PropertyType.residential.rawValue
    @objc dynamic var owner_type_value: String = OwnerType.individual.rawValue
    @objc dynamic var first_name: String = ""
    @objc dynamic var surname: String = ""
    //full name
    var full_name: String {
        return first_name + " " + surname
    }
    @objc dynamic var mobile: String = ""
    @objc dynamic var email: String = ""
    var home_owner_abn: String = ""
    @objc dynamic var home_owner_abn_valid_flag: Bool = false
    @objc dynamic var company_name: String = ""
    @objc dynamic var owner_representative_name: String = ""
    @objc dynamic var owner_representative_position: String = ""
    //owner's stc unit price字段名和类型待定
    @objc dynamic var price_to_the_home_owner: String = ""
    //是否显示Co owner info
    var showCoOwnerFlag: Bool = true
    //co owner name
    @objc dynamic var co_owner_optional: Bool = false
    @objc dynamic var co_owner_first_name: String = ""
    @objc dynamic var co_owner_surname: String = ""
    //full name
    var co_owner_full_name: String {
        return co_owner_first_name + " " + co_owner_surname
    }
    @objc dynamic var co_owner_relation_ship: String = ""
    var co_owner_relation_ship_name: String {
        var retName = ""
        if let value = CoOwnerRelationShipValue(rawValue: co_owner_relation_ship){
            switch value {
            case .partner:
                retName = CoOwnerRelationShipName.partner.rawValue
            case .familyMenber:
                retName = CoOwnerRelationShipName.familyMenber.rawValue
            case .coowner:
                retName = CoOwnerRelationShipName.coowner.rawValue
            }
        }
        return retName
    }
    //
    //gst，install_additional_information新版本4.0.0取消不要
    var gst: Bool = false
    var commercial_gst: Bool = false//根据check ABN返回的gst
//    var install_additional_information: String = ""
    var editFlag: Bool = false//是否是编辑数据
    required override init() {
        
    }
}
